package com.orjl.networkj;

import com.google.gson.annotations.SerializedName;

/**
 * 版权： 版权所有
 * <p>
 * 作者：suntinghui
 * <p>
 * 创建日期：2019/5/20 0020 16:03
 * <p>
 * 描述：
 * <p>
 * 修订历史：
 */
public class BaseResponseObjectModel<T> {

    @SerializedName("code")
    private int code;
    @SerializedName("message")
    private String msg;
    @SerializedName("newslist")
    private T newslist;

    public int getCode() {
        return code;
    }

    public boolean isSuccess() {
        if (200 == code) {
            return true;
        } else {
            return false;
        }
    }

    public BaseResponseObjectModel(int code, String msg, T newslist) {
        this.code = code;
        this.msg = msg;
        this.newslist = newslist;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getError() {
        return msg;
    }

    public void setError(String error) {
        this.msg = error;
    }

    public T getResult() {
        return newslist;
    }

    public void setResult(T result) {
        this.newslist = result;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public String toString() {
        return "httpResponse{" +
                "code=" + code +
                ", error='" + msg + '\'' +
                ", result=" + newslist +
                '}';
    }
}
